package org.demo.patten.visitor;

/**
 * @author zhuj
 * @date 2025/3/29
 * @apiNote
 */
public class Client {
    public static void main(String[] args) {
        Folder root = new Folder("根目录");
        root.add(new File("A.txt", 100));
        root.add(new File("B.txt", 200));
        Folder sub = new Folder("子目录");
        sub.add(new File("C.txt", 300));
        root.add(sub);
        SizeCalculatorVisitor visitor = new SizeCalculatorVisitor();
        root.accept(visitor);
        System.out.println("文件总大小：" + visitor.getTotalSize() + "KB");
    }
}
